home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC-SIG: Essential Home & Business
/
PC-SIG - Essential Home and Business Collection.iso
/
24
/
2
/
5
/
EXAMPLES.EXE
/
MOVE2.PWR
< prev
next >
Wrap
Text File
|
1991-05-08
|
3KB
|
48 lines
Variable CLP%1,79,"a" ;command line parm %1
Variable CLP%2,79,"a" ;%2
Variable InChar,1 ;for keyboard responses
Compare CLP%1,"a",,,Syntax ;show syntax
Compare CLP%2,"a",,,Syntax
Clear ;clear the screen
Upper CLP%1 ;make CLP%1 upper case
Upper CLP%2 ;make CLP%2 upper case
Write "Move " ;build initial msg
Write CLP%1
Write " to "
WriteLine CLP%2
Label ChkFile1
?FileExist CLP%1,File1OK ;does source file exist
Blink ;if not make screen text blink
Write CLP%1 ;write error msg
WriteLine " not found."
Normal ;set text to normal
Write "Enter source file name : " ;prompt user for new name
ReadStr CLP%1
GoTo ChkFile1
Label File1OK ;check new name for exists
?FileExist CLP%2,,File2OK ;does destination file exist
Blink ;if not then text to blink
Write CLP%2 ;write error message
WriteLine " exists!"
Normal ;set text to normal
ReadYN "Overwrite? [Y/N] ",InChar ;query user
WriteLine ""
Compare InChar,"N",,,BadCopy ;if user entered "Y" then exit
Label File2OK ;come here if all OK
Compare CLP%1,CLP%2,,,DupFiles ;cannot copy to itself
Copy CLP%1 CLP%2 ;DOS copy command
?FileExist CLP%2,,BadCopy ;is output file OK
Reverse ;make text reverse video
Write "Erasing " ;write erase message
WriteLine CLP%1
Normal ;set text back to normal
Erase CLP%1 ;DOS erase command
WriteLine "Move successful" ;tell user all is OK
Halt
Label DupFiles
WriteLine "Cannot move a file to itself"
Label BadCopy
WriteLine "Move unsuccessful"
Label Syntax
WriteLine "Syntax is Move2 SourceFileName TargetFileName"